Normalize Windows drive letter case in workspace document URIs - #719
Normalize Windows drive letter case in workspace document URIs#719Sanjays2402 wants to merge 2 commits into
Conversation
Windows drive letters are case-insensitive and clients may send either `file:///C:/foo` (RFC 8089) or `file:///c:/foo` for the same file. `uris.from_fs_path` lower-cases the drive letter, but `Workspace._docs` stored URIs verbatim, so the two spellings became distinct dictionary keys. A document opened under one spelling was then invisible under the other, and lookups silently fell back to reading stale content from disk instead of the in-memory version. Add `uris.normalize` and use it for every `_docs` key, so a document is found regardless of the drive letter case the client used. Non-drive paths are unchanged.
|
Hey @Sanjays2402, thanks for your contribution! There's a test that started to fail on Windows due to your changes. Please try to fix it. |
Workspace._docs is now keyed by uris.normalize(doc_uri), so on Windows a client-sent 'file:///C:/...' URI is stored as 'file:///c:/...'. The multiple-workspaces tests inspect _docs directly with the raw message URI, which no longer matches on Windows. Normalize the expected key in those assertions; behaviour on other platforms is unchanged.
|
Fixed. The failure was drive-letter case in |
Closes #697
Windows drive letters are case-insensitive, so a client may send
file:///C:/foo(RFC 8089) orfile:///c:/foofor the same file.uris.from_fs_pathlower-cases the drive letter butWorkspace._docsstored URIs verbatim, so the two spellings became separate dictionary keys — a document opened under one spelling was invisible under the other, and lookups silently fell back to stale on-disk content instead of the in-memory version.Adds
uris.normalizeand uses it for every_docskey. Non-drive paths are unchanged. New tests fail without the fix and pass with it.